function ToolBar(){
	this.p_arr_icon    = new Array();
	this.p_arr_caption = new Array();
	this.p_arr_event   = new Array();
	this.p_arr_width   = new Array();
	this.p_arr_tip     = new Array();
	this.p_arr_id      = new Array();
	
	this.nPos =0 ;
}

ToolBar.prototype.addToolButton = function(icon,cap,sEvent,tip,id){
	this.p_arr_icon[this.nPos]     = icon;
	this.p_arr_caption[this.nPos]  = cap;
	this.p_arr_event[this.nPos]    = sEvent;
	this.p_arr_width[this.nPos]    = (cap.length-2)*12 + 55 ;
	this.p_arr_tip[this.nPos]      = tip;
	this.p_arr_id[this.nPos]       = id;

	this.nPos += 1;
}

ToolBar.prototype.createEButton = function(cap,sEvent,tip,id,icon){
	this.p_arr_icon[this.nPos]     = icon;
	this.p_arr_caption[this.nPos]  = cap;
	this.p_arr_event[this.nPos]    = sEvent;
	this.p_arr_tip[this.nPos]      = tip;
	this.p_arr_id[this.nPos]       = id;

	this.nPos += 1;
}

ToolBar.prototype.createToolBar = function()  {

	document.write("<table border=0  cellpadding=0 cellspacing=0 width='100%' bgcolor=white><tbody>");
    document.write("<tr bordercolordark=#D4D7CE bordercolorlight=#D4D7CE>");
	for(var i=0;i<this.nPos;i++){
		if(this.p_arr_icon[i]!=""){
		  document.write("<td align=left noWrap width='"+this.p_arr_width[i]+"'tip='"+this.p_arr_tip[i]+"' ");
		  document.write(" onclick=\""+ this.p_arr_event[i] +"\" id=\""+this.p_arr_id[i]+"\">");
		  document.write("<span class=flatBtn style='width:"+this.p_arr_width[i]+"'>&nbsp;<img src='"+this.p_arr_icon[i]+"'>"+this.p_arr_caption[i]);
		  document.write("</span></td>");
		}else{
			if(p_arr_width[i]!=""){
			    document.write("<TD width="+this.p_arr_width[i]+" id="+this.p_arr_id[i]+">"+ this.p_arr_caption[i] +"</TD>");
			}else{
			    document.write("<TD align=right id=RecInfo>"+ this.p_arr_caption[i] +"</TD>");
			}
		}
	}
	document.write("<td>&nbsp;</td>");
	document.write("</tr></table>");
}

ToolBar.prototype.createEBar = function()  {
	var barHtml = "";
	var space = "";
	for(var i=0;i<this.nPos;i++){
		if(i==0){
			space ="";
		}else{
			space ="<span class=btnSpace></span>";
		}

		if(this.p_arr_icon[i]!=""){
		  barHtml += space + "<BUTTON class=CoolBtn id="+this.p_arr_id[i]+" onclick=" 
			    + this.p_arr_event[i]+" title="+this.p_arr_tip[i]+" >"+this.p_arr_caption[i]+"</BUTTON>";
		}else{
		  barHtml += space + "<BUTTON class=CoolBtn id="+this.p_arr_id[i]+" onclick="
		        + this.p_arr_event[i]+" title="+this.p_arr_tip[i]+" >"+this.p_arr_caption[i]+"</BUTTON>";
		}
	}
	var sHtml = "<TABLE style='WIDTH: 100%;'"; 
    sHtml += " cellSpacing=1 cellPadding=1 border=0 height=45>";
    sHtml += " <TR height=10><TD bgcolor=white></TD></TR>"; 
    sHtml += " <TR height=3>"; 
    sHtml += " <TD style='filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=1,";
    sHtml += " StartColorStr=orange, EndColorStr=white);WIDTH: 100%;'></TD></TR>"; 
	//sHtml += " <TR height=2><TD bgcolor=white></TD></TR>"; 
    sHtml += " <TR>"; 
    sHtml += " <TD align=center style='filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=1,";
    sHtml += " StartColorStr=#FFFFFF, EndColorStr=#397BBE);height:30px;' valign=middle>"+barHtml+"</TD>"; 
    sHtml += " </TR>"; 
    sHtml += " </TABLE>"; 
	document.write(sHtml);
}
ToolBar.prototype.out_Title = function(sTitle){
    var sHtml = "<TABLE style='WIDTH: 100%;margin-bottom:10px'"; 
    sHtml += " cellSpacing=0 cellPadding=0 bgColor=#efeded border=0  height=60px>";
    sHtml += " <TR>"; 
    sHtml += " <TD style='filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=1,";
    sHtml += " StartColorStr=#397BBE, EndColorStr=#FFFFFF);height:30px;'><span class=leftTitle>&nbsp;"+sTitle+"</span></TD>"; 
    sHtml += " </TR>"; 
    sHtml += " <TR height=3>"; 
    sHtml += " <TD style='filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=1,";
    sHtml += " StartColorStr=white, EndColorStr=orange);WIDTH: 100%;'></TD></TR>"; 
	sHtml += " <TR height=2><TD colSpan=3 bgcolor=white></TD></TR>";  
    sHtml += " </TABLE>"; 
	document.write(sHtml);
}
